
package com.lmx.repoDomain.repository;

import javax.annotation.PostConstruct;

import org.springframework.stereotype.Component;

import com.lmx.repoDomain.tmodel.EvaluateModelType;

import io.katharsis.repository.annotations.JsonApiResourceRepository;
import io.katharsis.repository.annotations.JsonApiSave;

@JsonApiResourceRepository(EvaluateModelType.class)
@Component
public class EvaluateModelTypeRepository extends BaseRepository<EvaluateModelType> {

	@PostConstruct
	public void init() {
		dslJpaService.setEntityClass(EvaluateModelType.class);
	}

	@Override
	@JsonApiSave
	public EvaluateModelType save(EvaluateModelType model) {
		if (model.getId() == null) {
			model = super.save(model);
		} else {
			if (model.getDelStatus() == 1) {// 删除
				dslJpaService.update(model);
			} else {
				model = super.save(model);
			}
		}
		return model;
	}

}
